class Solution {
public:
    vector<vector<int>> rst;
    vector<int> temp;
    
    vector<vector<int>> findSubsequences(vector<int>& nums) {
        findSubsequencesStep(nums, 0);
        return rst;
    }

    void findSubsequencesStep(vector<int>& nums, int start) {
        if(temp.size() > 1){
            rst.push_back(temp);
        }

        unordered_set<int> uset;
        for(int i = start; i < nums.size(); ++i) {
            if((temp.empty() == true) || nums[i] >= temp[temp.size() - 1])  {
                if(uset.find(nums[i]) != uset.end()) {
                    continue;
                }
                
                uset.insert(nums[i]);
                temp.push_back(nums[i]);
                findSubsequencesStep(nums, i + 1);
                temp.pop_back();
            }
        }
    }
};